package com.ftg.learn.chapter09.collection;

import java.util.LinkedList;
import java.util.Queue;

/**
 * 队列
 *
 * @author lijiaxin
 * @version 1.0
 * @date 2023/8/15 10:07
 */

public class LearnQueue {

    public static void main(String[] args) {

        //约瑟夫环
        Queue<Integer> nos = new LinkedList<>();
        for (int i = 0; i < 10; i++) {
            nos.add(i + 1);
        }
        System.out.println(nos);

        while (nos.size() > 1) {
            nos.add(nos.poll());
            nos.add(nos.poll());
            nos.poll();
            System.out.println("最终结果" + nos);
        }
    }
}
